package com.xhej.rowreat;

import tk.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.xhej.rowreat.interceptors.RuleInterceptor;

@SpringBootApplication
@EnableWebMvc
@MapperScan(basePackages = "com.xhej.rowreat.mapper")
public class Application extends WebMvcConfigurerAdapter implements CommandLineRunner{

	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}
	
	@Override
    public void run(String... args) throws Exception {
        
    }

 	@Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new RuleInterceptor()).addPathPatterns("/**");
    }
    @RequestMapping("/")
    String home() {
        return "redirect:/rowseat/order";
    }
}
